package com.hei.util;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class FileUpload {

    public static String fileUpload(MultipartFile file,String path) throws IOException {
        String fileName = file.getOriginalFilename();
        String suffix=fileName.substring(fileName.lastIndexOf("."));
        System.out.println(suffix);
        String targetFile=uuid.getUUId()+suffix;
        File realFile=new File(path+File.separator+targetFile);
        file.transferTo(realFile);
        System.out.println(realFile.getAbsolutePath());
        return targetFile;
    }

}
